package com.yuyou.activity.group.service;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.springframework.core.env.Environment;

import com.yuyou.activity.util.util.DateUtil;
import com.yuyou.activity.util.util.SpringUtil;

public class ActivityGroupSPConfig  {


	private String sysCode;
	
	/**
	 * #人数限制
	 */
	private int num;
		
	/**
	 * #结束时间设定
	 */
	private int closeHour;
	
	/**
	 * #禁止开团时间
	 */
	private Date openClose;
	
	/**
	 * #禁止开团时间
	 */
	private Date joinClose;
	
	/**
	 * 项目下架时间
	 */
	private Date allClose;
	
	/**
	 * 
	 */
	private String orderKey;
	
	/**
	 * 支付订单商品名字
	 */
	private String orderGoodName;
	
	
	/**
	 * 是否存在打包价
	 */
	private String packDiscount;
	
	/**
	 * 3科单人打包价
	 */
	private String sDiscount3;
	
	/**
	 * 3科拼团打包价
	 */
	private String gDiscount3;
	
	/**
	 * 退款开关
	 */
	private String refundOpt;
		
	
	
	
	public String getRefundOpt() {
		return refundOpt;
	}




	public void setRefundOpt(String refundOpt) {
		this.refundOpt = refundOpt;
	}




	public String getsDiscount3() {
		return sDiscount3;
	}




	public void setsDiscount3(String sDiscount3) {
		this.sDiscount3 = sDiscount3;
	}




	public String getgDiscount3() {
		return gDiscount3;
	}




	public void setgDiscount3(String gDiscount3) {
		this.gDiscount3 = gDiscount3;
	}




	public String getOrderGoodName() {
		return orderGoodName;
	}




	public void setOrderGoodName(String orderGoodName) {
		this.orderGoodName = orderGoodName;
	}




	public String getSysCode() {
		return sysCode;
	}




	public void setSysCode(String sysCode) {
		this.sysCode = sysCode;
	}




	public int getNum() {
		return num;
	}




	public void setNum(int num) {
		this.num = num;
	}




	public int getCloseHour() {
		return closeHour;
	}




	public void setCloseHour(int closeHour) {
		this.closeHour = closeHour;
	}




	public Date getOpenClose() {
		return openClose;
	}




	public void setOpenClose(Date openClose) {
		this.openClose = openClose;
	}




	public Date getJoinClose() {
		return joinClose;
	}




	public void setJoinClose(Date joinClose) {
		this.joinClose = joinClose;
	}




	public Date getAllClose() {
		return allClose;
	}




	public void setAllClose(Date allClose) {
		this.allClose = allClose;
	}

	public String getOrderKey() {
		return orderKey;
	}




	public void setOrderKey(String orderKey) {
		this.orderKey = orderKey;
	}



	
	




	public String getPackDiscount() {
		return packDiscount;
	}




	public void setPackDiscount(String packDiscount) {
		this.packDiscount = packDiscount;
	}

	private static Map<String,ActivityGroupSPConfig> configMap=new HashMap<String,ActivityGroupSPConfig>();

	public static ActivityGroupSPConfig getConfig(String project){
		ActivityGroupSPConfig config=configMap.get(project);		
		if(config==null){
			config=new ActivityGroupSPConfig();
			Environment env=(Environment)SpringUtil.getBean("environment");
			String num=env.getProperty(project+"_num");
			String closeHour=env.getProperty(project+"_closeHour");
			String openClose=env.getProperty(project+"_openClose");
			String joinClose=env.getProperty(project+"_joinClose");
			String allClose=env.getProperty(project+"_allClose");
			String sysCode=env.getProperty(project+"_sysCode");
			String orderKey=env.getProperty(project+"_orderKey");
			String orderGoodName=env.getProperty(project+"_orderGoodName");
			
			
			String packDiscount=env.getProperty(project+"_pack_discount");			
			String sDiscount3=env.getProperty(project+"_s_discount_3");
			String gDiscount3=env.getProperty(project+"_g_discount_3");
			
			String refundOpt=env.getProperty(project+"_refund_opt");
						
			config.setNum(Integer.parseInt(num));
			config.setCloseHour(Integer.parseInt(closeHour));
			Date openCloseD=DateUtil.parseDateByPattern(openClose, DateUtil.yyyyMMddHHmmss);
			config.setOpenClose(openCloseD);
			Date joinCloseD=DateUtil.parseDateByPattern(joinClose, DateUtil.yyyyMMddHHmmss);
			config.setJoinClose(joinCloseD);
			Date allCloseD=DateUtil.parseDateByPattern(allClose, DateUtil.yyyyMMddHHmmss);
			config.setAllClose(allCloseD);		
			config.setOrderKey(orderKey);			
			config.setSysCode(sysCode);
			config.setOrderGoodName(orderGoodName);
			
			config.setPackDiscount(packDiscount);
			config.setsDiscount3(sDiscount3);
			config.setgDiscount3(gDiscount3);
			config.setRefundOpt(refundOpt);
			configMap.put(project, config);
		}
		return config;
	}
	


}
